#include "pseDnsCacheer.h"

PseDnsCacheer::PseDnsCacheer() : size(0), expired_time(0){
}

PseDnsCacheer::~PseDnsCacheer(){
}

int PseDnsCacheer::dns_cached(int size, time_t expired_time, char *host, size_t host_len, 
                              char *ip, size_t ip_len){
    assert(size >= 0);
    assert(ip != NULL);
    assert(ip_len >= 0);
    unsigned int hash_size = 100000;    
    set_expired_seconds(expired_time);
    init(size, hash_size);
    if(insert(host, host_len, ip, ip_len) != true){
        printf("cacheer insert is failed\n");
        return -1;
    }
    return -1;
}

void PseDnsCacheer::dump_report(char *cache_name, char* filename){
    assert(filename != NULL);
    report(cache_name, filename);
}

bool PseDnsCacheer::dump_file(char *filename){
    return false;
}

bool PseDnsCacheer::load_file(const char* filename){
    assert(filename != NULL);
    if((load_file(filename)) == true){
        return true;
    }
    return false;
}
